package com.muse.constant;

import lombok.Getter;

/**
 * Created with IntelliJ IDEA.
 * User: lee
 * Date: 2021/4/26
 * Time: 5:28 下午
 * Description:
 */
public enum ManageRole {
    UNKNOWN("无角色", 0),
    LECTURER("讲师", 1),
    ADMIN("超级管理员", 2);

    @Getter
    private String name;

    @Getter
    private int value;

    ManageRole(String name, Integer value) {
        this.name = name;
        this.value = value;
    }

    public static ManageRole getManageRoleByValue(int value) {
        for (ManageRole type : ManageRole.values()) {
            if (type.getValue() == value) {
                return type;
            }
        }
        return UNKNOWN;
    }

    public static ManageRole getManageRoleName(String name) {
        for (ManageRole type : ManageRole.values()) {
            if (type.getName().equals(name)) {
                return type;
            }
        }
        return UNKNOWN;
    }
}
